import React, { Component } from 'react'
import logo from './logo.png'
export default class Cary extends Component {
  state = {
    x: 0,
    y: 0
  }
  render() {
    return (
      <div>
        <img style={
          {
            left: this.state.x,
            top: this.state.y,
            position: 'absolute'
          }
        } src={logo} alt="" />
      </div>
    )
  }
  move = e => {
    this.setState({
      x: e.pageX,
      y: e.pageY
    })
  }
  componentDidMount() {
    document.addEventListener('mousemove', this.move)
  }
  componentWillUnmount() {
    document.removeEventListener('mousemove', this.move)
  }

}
